import ajax from './ajax'

// 1. 基础路径
const BASE_URL = '/api';
// const BASE_URL = 'http://localhost:3000' 

// 2. 请求方式

// 请求首页轮播图
export const getHomeCasual = ()=>ajax(BASE_URL+ '/api/homecasual')

// 请求首页导航
export const getHomeNav = ()=>ajax(BASE_URL+ '/api/homenav')

// 请求首页商品数据
export const getHomeShopList = ()=>ajax(BASE_URL+ '/api/homeshoplist')

// 请求推荐商品的数据
export const getRecommendShopList = (params)=>ajax(BASE_URL+ '/api/recommendshoplist',params)

// 请求搜索列表数据
export const getSearchGoods = ()=>ajax(BASE_URL+ '/api/searchgoods')

// 请求手机验证码
export const getPhoneCode = (phone)=>ajax(BASE_URL+ '/api/send_code',{phone})

// 手机验证码登录
export const phoneCodeLogin = (phone, code)=>ajax(BASE_URL+ '/api/login_code',{phone, code}, 'POST')

// 用户名密码登录
export const pwdLogin = (name, pwd, captcha)=>ajax(BASE_URL+ '/api/login_pwd',{name, pwd, captcha}, 'POST')

// 获取登录用户信息
export const getUserInfo = ()=>ajax(BASE_URL+ '/api/user_info')

// 退出登录
export const getLogOut = ()=>ajax(BASE_URL+ '/api/logout')


